<?php

//
//  Copyright (C) 2004-2006  Autodesk, Inc.
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of version 2.1 of the GNU Lesser
//  General Public License as published by the Free Software Foundation.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

?>

<?php
require_once("config.php");
require_once("utils.php");
require_once(ROOT_DIR_CLASES.'/cCliente.php'); 
require_once 'JSON.php';

class MantenimientoResponse
{
   	var $id;
	var $motivo;
	var $activo;   	
	var $fechaInicio;
	var $fechaFin;
	var $tiempoEstimado;
	var $hoy;
}

class QueryMantenimiento
{
	
	private $args = null;
	
	function __construct($args)
	{
		$this->args = $args;
	}

	function Execute()
	{
		$result = array();
        //--------------------------------------	
   		$mantenimiento = BykomCliente::verificarMantenimiento();
		$response = new MantenimientoResponse();
		$response->activo = 0;
		if ($mantenimiento->cantidad()>0) {
			$response->id 		= $mantenimiento->campo('id',0);
			$response->motivo 	= $mantenimiento->campo('motivo',0);
			$response->activo 	= $mantenimiento->campo('activo',0);
			$response->fechaInicio 		= $mantenimiento->campo('fechaInicio',0);
			$response->fechaFin = $mantenimiento->campo('fechaFin',0);
			$response->tiempoEstimado 	= $mantenimiento->campo('tiempoEstimado',0);
			$response->emailStatus = $mantenimiento->campo('emailStatus',0);
			$response->hoy 		= $mantenimiento->campo('hoy',0);
			}
		array_push($result, $response);
		$mailstatus = 0;
		$mailstate = BykomCliente::verificarMailStatus();
		if ($mailstate->cantidad()>0){
			$mailstatus = $mailstate->campo('emailStatus',0);
		}	
		array_push($result, $mailstatus);	
		return $result;
	}
}
?>